home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / gamesmaster / source / asm / screendemos / agafade.s next >
Encoding:
Text File  |  1996-09-11  |  4.1 KB  |  140 lines

  1. ;AGA Fade
  2. ;--------
  3. ;Fades in a 32 colour AGA picture (24 bit colour).  Then up to a specified
  4. ;colour (greenish yellow), and then out to black.
  5. ;
  6. ;Press left mouse button to exit.
  7.  
  8.     opt    o+
  9.  
  10.     INCLUDE    "exec/exec_lib.i"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i
  13.  
  14. CALL    MACRO
  15.     jsr    _LVO\1(a6)
  16.     ENDM
  17.  
  18.     SECTION    "AGAFade",CODE
  19.  
  20. ;===========================================================================;
  21. ;                             INITIALISE DEMO
  22. ;===========================================================================;
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    ($4).w,a6
  26.     lea    GMS_Name(pc),a1
  27.     moveq    #$00,d0
  28.     CALL    OpenLibrary
  29.     move.l    d0,GMS_Base
  30.     beq    Quit
  31.  
  32.     move.l    GMS_Base(pc),a6          ;Initialise our screen.
  33.     lea    ScreenStruct(pc),a0     
  34.     CALL    Add_Screen
  35.     tst.l    d0
  36.     bne.s    Error
  37.  
  38.     lea    PicFile(pc),a0           ;a0 = Picture file.
  39.     lea    Picture(pc),a1           ;a1 = Picture struct.
  40.     move.l    ScreenStruct+SS_MemPtr1(pc),PIC_Data(a1)
  41.     CALL    LoadPic
  42.     tst.w    d0
  43.     bne.s    ReturnToDOS
  44.  
  45.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  46.     CALL    Show_Screen
  47.  
  48. ;===========================================================================;
  49. ;                                MAIN CODE
  50. ;===========================================================================;
  51.  
  52.     moveq    #$00,d0                  ;d0 = FadeState
  53.     moveq    #2,d1                    ;d1 = Speed of fade.
  54.     lea    Palette(pc),a1           ;a1 = Palette to fade to.
  55. .f_in    CALL    Wait_OSVBL
  56.     CALL    B24_FadeToPalette        ;Do the fade routine.
  57.     tst.w    d0                       ;Has the fade finished yet?
  58.     bne.s    .f_in                    ;If not, keep doing it.
  59.  
  60.     moveq    #$00,d0                  ;d0 = FadeState
  61.     moveq    #2,d1                    ;d1 = Speed of fade.
  62.     move.l    #$a5F343,d2              ;d2 = Colour.
  63. .f_mid    CALL    Wait_OSVBL
  64.     CALL    B24_FadeToColour         ;Do the fade routine.
  65.     tst.w    d0                       ;Has the fade finished yet?
  66.     bne.s    .f_mid                   ;If not, keep doing it.
  67.  
  68.     moveq    #$00,d0                  ;d0 = FadeState
  69.     moveq    #2,d1                    ;d1 = Speed of fade.
  70. .f_out    CALL    Wait_OSVBL
  71.     CALL    B24_FadeToBlack          ;Do the fade routine.
  72.     tst.w    d0                       ;Has the fade finished yet?
  73.     bne.s    .f_out                   ;If not, keep doing it.
  74.  
  75. ;===========================================================================;
  76. ;                              RETURN TO DOS
  77. ;===========================================================================;
  78.  
  79. ReturnToDOS:
  80.     move.l    GMS_Base(pc),a6
  81.     lea    ScreenStruct(pc),a0
  82.     CALL    Delete_Screen            ;Give back screen memory etc.
  83. Error    move.l    ($4).w,a6
  84.     move.l    GMS_Base(pc),a1
  85.     CALL    CloseLibrary
  86. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  87.     moveq    #$00,d0
  88.     rts
  89.  
  90. ;===========================================================================;
  91. ;                                  DATA
  92. ;===========================================================================;
  93.  
  94. GMS_Name:
  95.     dc.b    "games.library",0
  96.     even
  97. GMS_Base:
  98.     dc.l    0
  99.  
  100. AMT_PLANES =    5
  101.  
  102. ScreenStruct:
  103.     dc.l    "GSV1",0
  104.     dc.l    0,0,0               ;Screen_Mem1/2/3
  105.     dc.l    0                   ;Screen link.
  106.     dc.l    0 ;Palette          ;Address of palette.
  107.     dc.l    0                   ;Address of rasterlist.
  108.     dc.l    32                  ;Amt of colours in palette.
  109.     dc.w    320,256,320,256     ;Screen & Pic Height/Width.
  110.     dc.w    AMT_PLANES          ;Amt of planes.
  111.     dc.w    0,0                 ;X/Y top of screen offsets.
  112.     dc.w    0,0                 ;X/Y pic offsets.
  113.     dc.l    0                   ;Special attributes.
  114.     dc.w    LORES|COL24BIT      ;Screen mode.
  115.     dc.b    INTERLEAVED         ;Screen type
  116.     dc.b    0                   ;Reserved.
  117.     even
  118.  
  119. Palette    dc.l    $000000,$080808,$101010,$191919
  120.     dc.l    $212121,$292929,$313131,$3A3A3A
  121.     dc.l    $424242,$4A4A4A,$525252,$5A5A5A
  122.     dc.l    $636363,$6B6B6B,$737373,$7B7B7B
  123.     dc.l    $848484,$8C8C8C,$949494,$9C9C9C
  124.     dc.l    $A5A5A5,$ADADAD,$B5B5B5,$BDBDBD
  125.     dc.l    $C5C5C5,$CECECE,$D6D6D6,$7F7F7F
  126.     dc.l    $9B9B9B,$707070,$444444,$1E1E1E
  127.  
  128. Picture    dc.l    "PCV1",0    ;Version header.
  129.     dc.l    0    ;Source data.
  130.     dc.w    320,256    ;Width, Height.
  131.     dc.w    AMT_PLANES    ;Amount of Planes.
  132.     dc.l    32    ;Amount of colours.
  133.     dc.l    Palette    ;Source palette (remap).
  134.     dc.w    LORES|COL24BIT    ;Screen mode.
  135.     dc.w    INTERLEAVED    ;Destination
  136.     dc.l    0    ;Parameters.
  137.  
  138. PicFile    dc.b    "GAMESLIB:data/IFF.Loading",0
  139.     even
  140.